package com.business.sys.service.impl;


import com.baomidou.mybatisplus.mapper.EntityWrapper;
import com.business.common.dto.R;
import com.business.sys.entity.DictionaryItem;
import com.business.sys.mapper.DictionaryItemMapper;
import com.business.sys.service.DictionaryItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.HashMap;
import java.util.List;
import java.util.Map;


/**
 * 字典项表:业务接口实现类
 * @author chenjiehong
 * @date 2019-04-28 15:03:17
 * @since 1.0
 */
@Service
public class DictionaryItemServiceImpl implements DictionaryItemService {
    
    @Autowired
    private DictionaryItemMapper sysDictionaryItemMapper;

    @Override
    @Transactional(readOnly = true)
    public List<DictionaryItem> query(int type){
        EntityWrapper<DictionaryItem> entityWrapper = new EntityWrapper<>();
        entityWrapper.eq("type_id",type).eq("state",1).orderBy("sort");
        List<DictionaryItem> sysDictionaryItem = sysDictionaryItemMapper.selectList(entityWrapper);

        return sysDictionaryItem;
    }

    @Override
    @Transactional(readOnly = true)
    public DictionaryItem queryById(int id) {
        return sysDictionaryItemMapper.selectById(id) ;
    }


}